#include "Config.h"
#include "GateObject.h"
#include "Object.h"
#include <SDL_image.h>

#define GFX_PATH "gfx/gate.png"

SDL_Surface *GateObject::sTexture = 0;

int
GateObject::PreloadGraphic()
{
  sTexture = IMG_Load(GFX_PATH);
  if (!sTexture)
    return E_ERROR;

  return E_OK;
}


// #pragma mark -


GateObject::GateObject(Engine *parent, unsigned int x, unsigned int y)
  : Object(x, y, parent)
{
  if (!sTexture) {
    int err;
    err = PreloadGraphic(); 
    if (err < E_OK)
      throw int(err);
  }

  fGraphic = sTexture;
}

GateObject::~GateObject()
{
}

int
GateObject::Invoke()
{
  return I_GATE;
}

